package cn.ibizlab.odoo.core.odoo_crm.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Icrm_team;
import cn.ibizlab.odoo.core.odoo_crm.domain.Crm_team;
import cn.ibizlab.odoo.core.odoo_crm.filter.Crm_teamSearchContext;
import cn.ibizlab.odoo.core.odoo_crm.service.ICrm_teamService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[销售渠道] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Crm_teamServiceImpl implements ICrm_teamService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Icrm_teamClientService crm_teamClientService;

    @Override
    public Crm_team get(Integer id) {
        Icrm_team clientModel = crm_teamClientService.createModel();
        clientModel.setId(id);
        crm_teamClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Crm_team get(Crm_team crm_team) {
        Crm_team retcrm_team = this.get(crm_team.getId()) ;
    	BeanCopier copier=BeanCopier.create(retcrm_team.getClass(), crm_team.getClass(), false);
        copier.copy(retcrm_team, crm_team, null);
        return crm_team ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //crm_teamClientService.removeBatch(crm_teams) ;

    }

    @Override
    public void createBatch(List<Crm_team> crm_teams, int batchSize) {

                        //crm_teamClientService.createBatch(crm_teams,batchSize) ;

    }

    @Override
    public boolean update(Crm_team crm_team) {
        boolean bOk = false ;
        Icrm_team clientModel = this.convert2Model(crm_team,null);
        crm_teamClientService.update(clientModel) ;
        this.convert2Domain(clientModel,crm_team) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Icrm_team clientModel = crm_teamClientService.createModel();
        clientModel.setId(id);
        crm_teamClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public boolean create(Crm_team crm_team) {
        boolean bOk = false ;
        Icrm_team clientModel = this.convert2Model(crm_team,null);
        crm_teamClientService.create(clientModel) ;
        this.convert2Domain(clientModel,crm_team);
        bOk = true ;

        return bOk ;
    }

    @Override
    public void updateBatch(List<Crm_team> crm_teams, int batchSize) {

        //crm_teamClientService.updateBatch(crm_teams,batchSize) ;

    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Crm_team> searchDefault(Crm_teamSearchContext context) {
        List<Crm_team> list = new ArrayList<Crm_team>();
        Page<cn.ibizlab.odoo.core.client.model.Icrm_team> clientModelList = crm_teamClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Icrm_team clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Crm_team>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据EMail别名查询
     */
    @Override
    public Page<Crm_team> selectByOdoo_alias(Integer id){
        Crm_teamSearchContext context = new Crm_teamSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Crm_team> list = new ArrayList<Crm_team>();
        Page<cn.ibizlab.odoo.core.client.model.Icrm_team> clientModelList = crm_teamClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Icrm_team clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Crm_team>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Crm_team> selectByOdoo_company(Integer id){
        Crm_teamSearchContext context = new Crm_teamSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Crm_team> list = new ArrayList<Crm_team>();
        Page<cn.ibizlab.odoo.core.client.model.Icrm_team> clientModelList = crm_teamClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Icrm_team clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Crm_team>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Crm_team> selectByOdoo_create(Integer id){
        Crm_teamSearchContext context = new Crm_teamSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Crm_team> list = new ArrayList<Crm_team>();
        Page<cn.ibizlab.odoo.core.client.model.Icrm_team> clientModelList = crm_teamClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Icrm_team clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Crm_team>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Crm_team> selectByOdoo_user(Integer id){
        Crm_teamSearchContext context = new Crm_teamSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Crm_team> list = new ArrayList<Crm_team>();
        Page<cn.ibizlab.odoo.core.client.model.Icrm_team> clientModelList = crm_teamClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Icrm_team clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Crm_team>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Crm_team> selectByOdoo_write(Integer id){
        Crm_teamSearchContext context = new Crm_teamSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Crm_team> list = new ArrayList<Crm_team>();
        Page<cn.ibizlab.odoo.core.client.model.Icrm_team> clientModelList = crm_teamClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Icrm_team clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Crm_team>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Icrm_team convert2Model(Crm_team domain , Icrm_team model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = crm_teamClientService.createModel() ;
        }

         if(domain.getOpportunities_amountDirtyFlag())
            model.setOpportunities_amount(domain.getOpportunities_amount());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getUse_opportunitiesDirtyFlag())
            model.setUse_opportunities(domain.getUse_opportunities());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getQuotations_countDirtyFlag())
            model.setQuotations_count(domain.getQuotations_count());
         if(domain.getDashboard_graph_typeDirtyFlag())
            model.setDashboard_graph_type(domain.getDashboard_graph_type());
         if(domain.getIs_favoriteDirtyFlag())
            model.setIs_favorite(domain.getIs_favorite());
         if(domain.getOpportunities_countDirtyFlag())
            model.setOpportunities_count(domain.getOpportunities_count());
         if(domain.getColorDirtyFlag())
            model.setColor(domain.getColor());
         if(domain.getUse_quotationsDirtyFlag())
            model.setUse_quotations(domain.getUse_quotations());
         if(domain.getReply_toDirtyFlag())
            model.setReply_to(domain.getReply_to());
         if(domain.getFavorite_user_idsDirtyFlag())
            model.setFavorite_user_ids(domain.getFavorite_user_ids());
         if(domain.getTeam_typeDirtyFlag())
            model.setTeam_type(domain.getTeam_type());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getDashboard_graph_modelDirtyFlag())
            model.setDashboard_graph_model(domain.getDashboard_graph_model());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getDashboard_graph_period_pipelineDirtyFlag())
            model.setDashboard_graph_period_pipeline(domain.getDashboard_graph_period_pipeline());
         if(domain.getAbandoned_carts_countDirtyFlag())
            model.setAbandoned_carts_count(domain.getAbandoned_carts_count());
         if(domain.getPos_config_idsDirtyFlag())
            model.setPos_config_ids(domain.getPos_config_ids());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getUse_leadsDirtyFlag())
            model.setUse_leads(domain.getUse_leads());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getWebsite_idsDirtyFlag())
            model.setWebsite_ids(domain.getWebsite_ids());
         if(domain.getQuotations_amountDirtyFlag())
            model.setQuotations_amount(domain.getQuotations_amount());
         if(domain.getInvoicedDirtyFlag())
            model.setInvoiced(domain.getInvoiced());
         if(domain.getAbandoned_carts_amountDirtyFlag())
            model.setAbandoned_carts_amount(domain.getAbandoned_carts_amount());
         if(domain.getActiveDirtyFlag())
            model.setActive(domain.getActive());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getSales_to_invoice_countDirtyFlag())
            model.setSales_to_invoice_count(domain.getSales_to_invoice_count());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.getUnassigned_leads_countDirtyFlag())
            model.setUnassigned_leads_count(domain.getUnassigned_leads_count());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.getDashboard_graph_group_posDirtyFlag())
            model.setDashboard_graph_group_pos(domain.getDashboard_graph_group_pos());
         if(domain.getMember_idsDirtyFlag())
            model.setMember_ids(domain.getMember_ids());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getInvoiced_targetDirtyFlag())
            model.setInvoiced_target(domain.getInvoiced_target());
         if(domain.getDashboard_graph_groupDirtyFlag())
            model.setDashboard_graph_group(domain.getDashboard_graph_group());
         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getDashboard_graph_dataDirtyFlag())
            model.setDashboard_graph_data(domain.getDashboard_graph_data());
         if(domain.getDashboard_graph_periodDirtyFlag())
            model.setDashboard_graph_period(domain.getDashboard_graph_period());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getPos_sessions_open_countDirtyFlag())
            model.setPos_sessions_open_count(domain.getPos_sessions_open_count());
         if(domain.getUse_invoicesDirtyFlag())
            model.setUse_invoices(domain.getUse_invoices());
         if(domain.getDashboard_button_nameDirtyFlag())
            model.setDashboard_button_name(domain.getDashboard_button_name());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getDashboard_graph_group_pipelineDirtyFlag())
            model.setDashboard_graph_group_pipeline(domain.getDashboard_graph_group_pipeline());
         if(domain.getPos_order_amount_totalDirtyFlag())
            model.setPos_order_amount_total(domain.getPos_order_amount_total());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getAlias_domainDirtyFlag())
            model.setAlias_domain(domain.getAlias_domain());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getAlias_model_idDirtyFlag())
            model.setAlias_model_id(domain.getAlias_model_id());
         if(domain.getAlias_parent_model_idDirtyFlag())
            model.setAlias_parent_model_id(domain.getAlias_parent_model_id());
         if(domain.getAlias_contactDirtyFlag())
            model.setAlias_contact(domain.getAlias_contact());
         if(domain.getAlias_user_idDirtyFlag())
            model.setAlias_user_id(domain.getAlias_user_id());
         if(domain.getCurrency_idDirtyFlag())
            model.setCurrency_id(domain.getCurrency_id());
         if(domain.getAlias_defaultsDirtyFlag())
            model.setAlias_defaults(domain.getAlias_defaults());
         if(domain.getAlias_parent_thread_idDirtyFlag())
            model.setAlias_parent_thread_id(domain.getAlias_parent_thread_id());
         if(domain.getAlias_force_thread_idDirtyFlag())
            model.setAlias_force_thread_id(domain.getAlias_force_thread_id());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getUser_id_textDirtyFlag())
            model.setUser_id_text(domain.getUser_id_text());
         if(domain.getAlias_nameDirtyFlag())
            model.setAlias_name(domain.getAlias_name());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getAlias_idDirtyFlag())
            model.setAlias_id(domain.getAlias_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getUser_idDirtyFlag())
            model.setUser_id(domain.getUser_id());
        return model ;
    }

    public Crm_team convert2Domain( Icrm_team model ,Crm_team domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Crm_team();
        }

        if(model.getOpportunities_amountDirtyFlag())
            domain.setOpportunities_amount(model.getOpportunities_amount());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getUse_opportunitiesDirtyFlag())
            domain.setUse_opportunities(model.getUse_opportunities());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getQuotations_countDirtyFlag())
            domain.setQuotations_count(model.getQuotations_count());
        if(model.getDashboard_graph_typeDirtyFlag())
            domain.setDashboard_graph_type(model.getDashboard_graph_type());
        if(model.getIs_favoriteDirtyFlag())
            domain.setIs_favorite(model.getIs_favorite());
        if(model.getOpportunities_countDirtyFlag())
            domain.setOpportunities_count(model.getOpportunities_count());
        if(model.getColorDirtyFlag())
            domain.setColor(model.getColor());
        if(model.getUse_quotationsDirtyFlag())
            domain.setUse_quotations(model.getUse_quotations());
        if(model.getReply_toDirtyFlag())
            domain.setReply_to(model.getReply_to());
        if(model.getFavorite_user_idsDirtyFlag())
            domain.setFavorite_user_ids(model.getFavorite_user_ids());
        if(model.getTeam_typeDirtyFlag())
            domain.setTeam_type(model.getTeam_type());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getDashboard_graph_modelDirtyFlag())
            domain.setDashboard_graph_model(model.getDashboard_graph_model());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getDashboard_graph_period_pipelineDirtyFlag())
            domain.setDashboard_graph_period_pipeline(model.getDashboard_graph_period_pipeline());
        if(model.getAbandoned_carts_countDirtyFlag())
            domain.setAbandoned_carts_count(model.getAbandoned_carts_count());
        if(model.getPos_config_idsDirtyFlag())
            domain.setPos_config_ids(model.getPos_config_ids());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getUse_leadsDirtyFlag())
            domain.setUse_leads(model.getUse_leads());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getWebsite_idsDirtyFlag())
            domain.setWebsite_ids(model.getWebsite_ids());
        if(model.getQuotations_amountDirtyFlag())
            domain.setQuotations_amount(model.getQuotations_amount());
        if(model.getInvoicedDirtyFlag())
            domain.setInvoiced(model.getInvoiced());
        if(model.getAbandoned_carts_amountDirtyFlag())
            domain.setAbandoned_carts_amount(model.getAbandoned_carts_amount());
        if(model.getActiveDirtyFlag())
            domain.setActive(model.getActive());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getSales_to_invoice_countDirtyFlag())
            domain.setSales_to_invoice_count(model.getSales_to_invoice_count());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.getUnassigned_leads_countDirtyFlag())
            domain.setUnassigned_leads_count(model.getUnassigned_leads_count());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.getDashboard_graph_group_posDirtyFlag())
            domain.setDashboard_graph_group_pos(model.getDashboard_graph_group_pos());
        if(model.getMember_idsDirtyFlag())
            domain.setMember_ids(model.getMember_ids());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getInvoiced_targetDirtyFlag())
            domain.setInvoiced_target(model.getInvoiced_target());
        if(model.getDashboard_graph_groupDirtyFlag())
            domain.setDashboard_graph_group(model.getDashboard_graph_group());
        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getDashboard_graph_dataDirtyFlag())
            domain.setDashboard_graph_data(model.getDashboard_graph_data());
        if(model.getDashboard_graph_periodDirtyFlag())
            domain.setDashboard_graph_period(model.getDashboard_graph_period());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getPos_sessions_open_countDirtyFlag())
            domain.setPos_sessions_open_count(model.getPos_sessions_open_count());
        if(model.getUse_invoicesDirtyFlag())
            domain.setUse_invoices(model.getUse_invoices());
        if(model.getDashboard_button_nameDirtyFlag())
            domain.setDashboard_button_name(model.getDashboard_button_name());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getDashboard_graph_group_pipelineDirtyFlag())
            domain.setDashboard_graph_group_pipeline(model.getDashboard_graph_group_pipeline());
        if(model.getPos_order_amount_totalDirtyFlag())
            domain.setPos_order_amount_total(model.getPos_order_amount_total());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getAlias_domainDirtyFlag())
            domain.setAlias_domain(model.getAlias_domain());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getAlias_model_idDirtyFlag())
            domain.setAlias_model_id(model.getAlias_model_id());
        if(model.getAlias_parent_model_idDirtyFlag())
            domain.setAlias_parent_model_id(model.getAlias_parent_model_id());
        if(model.getAlias_contactDirtyFlag())
            domain.setAlias_contact(model.getAlias_contact());
        if(model.getAlias_user_idDirtyFlag())
            domain.setAlias_user_id(model.getAlias_user_id());
        if(model.getCurrency_idDirtyFlag())
            domain.setCurrency_id(model.getCurrency_id());
        if(model.getAlias_defaultsDirtyFlag())
            domain.setAlias_defaults(model.getAlias_defaults());
        if(model.getAlias_parent_thread_idDirtyFlag())
            domain.setAlias_parent_thread_id(model.getAlias_parent_thread_id());
        if(model.getAlias_force_thread_idDirtyFlag())
            domain.setAlias_force_thread_id(model.getAlias_force_thread_id());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getUser_id_textDirtyFlag())
            domain.setUser_id_text(model.getUser_id_text());
        if(model.getAlias_nameDirtyFlag())
            domain.setAlias_name(model.getAlias_name());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getAlias_idDirtyFlag())
            domain.setAlias_id(model.getAlias_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getUser_idDirtyFlag())
            domain.setUser_id(model.getUser_id());
        return domain ;
    }


}
